import re

s = 'http://www.baidu.com'
p = 'http.+com'

# print(type(r))
# res = r.match(s)

# res = re.match(p,s)
r = re.compile(p)
res = r.match(s)
# res = re.match(r,s)

print(res.group())

print('*' * 20)
# 1.匹配出163的邮箱地址，且@符号前有4-20位。例如
# s = 'hello@163.com'
s = '<img data-original="https://rpic.douyucdn.cn/appCovers/2016/11/13/1213973_201611131917_small.jpg"' \
    ' src="https://rpic.douyucdn.cn/appCovers/2016/11/13/1213973_201611131917_small.jpg" style="display: inline;">'
# p = '\w{4,20}@163[.]com'
# p = '\w{4,20}@163\.com'
# p = '\w{4,20}@163.com'
p = 'https.+?jpg'
res = re.search(p, s)
print(res.group())

res1 = re.findall(p,s)
print(res1)


